import Request from '@/util/pocky-request/index'

function _getGoodsInfo(Id) {
	return Request().request({
		url: 'api/Goods/GetGoods',
		data: {
			GoodsId: Id || ''
		}
	})
}

function createOrder(data) {
	return Request().request({
		url: 'api/Order/PlaceOrder',
		method: 'PUT',
		data: data
	})
}

function recharge(data) {
	if (!data.balance || data.balance <= 0) {
		uni.showToast({
			icon: 'none',
			title: '请输入正确的金额'
		})
		return false;
	}
	return Request().request({
		url: 'api/Agency/CreateAgencyCharege',
		method: 'PUT',
		data: data
	})
}
export const getGoodsInfo = _getGoodsInfo;
export const _createOrder = createOrder;

export const _recharge = recharge;
